<template>
	<view class="content">
		<image class="logo" src="/static/logo.png" @click="upImage()"></image>
		<view class="text-area">
			<text class="title" @click="changeTitle()">{{title}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		onLoad() {

		},
		onPullDownRefresh() {
			console.log('监听用户下拉动作');
		},
		onReachBottom() {
			console.log('页面上拉触底事件的处理函数');
		},
		onShareAppMessage() {
			console.log('用户点击右上角转发');
		},
		onShareTimeline() {
			console.log('用户点击右上角转发到朋友圈');
		},
		onPageScroll() {
			console.log('页面滚动触发事件的处理函数');
		},
		methods: {
			changeTitle(){
				this.title = '小程序';
				uni.request({
				  url: 'https://www.baidu.com', //仅为示例，并非真实的接口地址
				  data: {
				    text: 'uni.request'
				  },
				  method:'GET',
				  header: {
				    'content-header': 'hello' // 默认值
				  },
				  success: (res) => {
				    console.log(res.data)
					this.text = 'request success';
				  },
				  fail() {
				  	
				  },
				  complete() {
				  	
				  }
				});
			},
			upImage(){
				uni.chooseImage({
					success: (chooseImageRes => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						console.log(tempFilePaths);
					})
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
